/**
 * Created by Administrator on 2018/8/9.
 */
//表格 配置 数据
var lendColumns = [{
    id: 'applicantName',
    title: '申请人',
    width: 75,
    type: 'string',
    columnClass: 'text-center',
}, {
    id: 'createTime',
    title: '申请时间',
    width: 150,
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
        var date = new Date(record.createTime);
        var content = $.fn.dlshouwen.grid.tools.dateFormat(date, "yyyy-MM-dd hh:mm");
        return content;
    }
}, {
    id: 'application',
    title: '申请用途',
    width: 75,
    type: 'string',
    columnClass: 'text-center',
}, {
    id: 'applyInstruction',
    title: '申请说明',
    type: 'string',
    columnClass: 'text-left',
},{
    id: 'operation',
    title: '操作',
    width: 60,
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
        var content = '';
        content += '<button class="btn btn-xs btn-primary" onclick="selast(\'' + record.brCode + '\');"><i class="icon-eye-open"></i>  查看</button>';
        return content;
    }
}];
//初始化  datagrid 表格
$CertusJsonAjax.dataInit("listBuyingRequisitionPagef",{projId:proId},lendColumns,"lendContainer","lendToolBarContainer");

var nowBrCode;
function selast(brCode){
    nowBrCode = brCode;

    $("#rightContainer").empty();
    $$http({
        // url: "proinfo/edit/edit-compact.html",
        url: "project/proinfo/purchaseInfoView.html",
        method: 'GET',
        data: {},
        dataType: "application/json"
    }).then(function (a) {
        $$scope.htmlxx = a.data
        $CertusFormAjax = $certusUtils;
    }, function (b) {
    })
}

$$scope.applyFor = function(){
    //打开 申请页面
    disApplyForView();
}

function disApplyForView(){
    $CertusFormAjax.ajax("projStatus",{projId:proId},function(res){
        if(res.data){
            if(res.data == "success"){
                $("#rightContainer").empty();
                $$http({
                    // url: "proinfo/edit/edit-compact.html",
                    url: "project/proinfo/buyingApplyFor.html",
                    method: 'GET',
                    data: {},
                    dataType: "application/json"
                }).then(function (a) {
                    $$scope.htmlxx = a.data
                    $CertusFormAjax = $certusUtils;
                }, function (b) {
                })
            }
            // layer.msg(res.data);
        }
    })

}